# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=xinit
pkgver=1.4.1
pkgrel=0
pkgdesc="X.Org initialisation program"
url="http://xorg.freedesktop.org"
arch="all"
license="MIT"
options="!check"  # No test suite.
subpackages="$pkgname-doc"
depends="xauth mcookie xmodmap xrdb"
makedepends="libx11-dev util-macros"
source="https://www.x.org/releases/individual/app/xinit-$pkgver.tar.bz2
	06_move_serverauthfile_into_tmp.patch
	xinitrc
	xsession.skel
	Xsession
	xserverrc"

builddir="$srcdir"/$pkgname-$pkgver
build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--with-xinitdir=/etc/X11/xinit
	make
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install
	chmod +x "$pkgdir"/usr/bin/startx
	install -m755 -d "$pkgdir"/etc/skel
	install -m755 -D "$srcdir"/xinitrc "$pkgdir"/etc/X11/xinit/xinitrc
	install -m755 -D "$srcdir"/Xsession "$pkgdir"/etc/X11/xinit/Xsession
	install -m755 "$srcdir"/xsession.skel "$pkgdir"/etc/skel/.xsession
	install -m755 "$srcdir"/xserverrc "$pkgdir"/etc/X11/xinit/xserverrc
	mkdir -p "$pkgdir"/etc/X11/xinit/xinitrc.d
}

sha512sums="6cbc5d025a891c419f3f4493381b2fca57a67d78df866d2f16a83426f86bad6eca7f240fac12b25cbcc63df0fec41f625407184e044898602d66483715315340  xinit-1.4.1.tar.bz2
2296c10a5d74bff42d9642a4787dc3f2b77492fc81174af48dc88cd3c8fa49c7f70147b790d8c82c2df6c910d9d412965999e7a342ca28697a97b5d522669edd  06_move_serverauthfile_into_tmp.patch
761db2ff2b501724ba8a7fde9df3d93851797a261871af205773159949bd74b4c1ac7c1afe0b816dce03825a5d7165caa474141cfb2ea82408abfe4719775ce0  xinitrc
448bc6c7987a4735b6584e307cd5c53092b1a338043293f5f110d11818dd1b80508401a3b6f09525c82a16a88f293b37011d8ca112460b0f95d26897e3e0619e  xsession.skel
b311032a751bb21d6c49ffe1dfc67beb577b5d5bec4a4c12612c4c0f9b9d6d2a07f7435c7d2fe9ab4c318546ee0cb9d4ff3f7ef908e756a818da529e913e667d  Xsession
f86d96d76bcb340021e7904925f0029f8662e4dfc32489198b3a8695dca069da496539e2287249c763fe9c4d8d5d591fd18fe49a0bee822cbbd0eb712efbb89b  xserverrc"
